﻿Imports System.Runtime.Serialization
Imports Framework

'List of Methods (Passthru)
Public Enum ERemoteDb
    'Low-Level
    ExecuteDataSet = 0
    ExecuteScalar = 1
    ExecuteNonQuery = 2

    'High-Level
    BulkSaveDelete = 3
    Delete = 4
    Insert = 5
    Update = 6
    [Select] = 7
    SelectCount = 8
    UpdateOrdinals = 9
    Paging = 10
    'PagingWithFilters = 11
    BulkSelect = 12

    'Remote Driver Access
    AllTableNames = 13
    SchemaInfo = 14

    'SqlServer only (or via webservice)
    BulkInsert = 15
    'BulkInsertWithTx = 16
End Enum


'Native Interface (Trivial overloads should go in the Client base class)
Public Interface IRemoteDb
    'Low-Level
    Function ExecuteDataSet(ByVal cmd As CCommand) As DataSet
    Function ExecuteScalar(ByVal cmd As CCommand) As Object
    Function ExecuteNonQuery(ByVal cmd As CCommand) As Integer
    'High-Level
    Sub BulkSaveDelete(ByVal saves As ICollection, ByVal deletes As ICollection, ByVal il As IsolationLevel)
    Function Delete(ByVal where As CWhere) As Integer
    Function Insert(ByVal tableName As String, ByVal pKeyName As String, ByVal insertPk As Boolean, ByVal data As CNameValueList, ByVal txOrNull As IDbTransaction, ByVal oracleSequenceName As String) As Object
    Function Update(ByVal data As CNameValueList, ByVal where As CWhere) As Integer
    Function [Select](ByVal where As CSelectWhere, ByVal type As EQueryReturnType) As Object
    Function SelectCount(ByVal where As CWhere) As Integer
    Function UpdateOrdinals(ByVal tableName As String, ByVal pKeyName As String, ByVal ordinalName As String, ByVal data As CNameValueList) As Integer
    Function Paging(ByRef count As Integer, ByVal pageIndex As Integer, ByVal pageSize As Integer, ByVal tableName As String, ByVal descending As Boolean, ByVal sortByColumn As String, ByVal selectColumns As String, criteriaOrNull As CCriteriaList, ByVal type As EQueryReturnType) As Object

    Function BulkSelect(ByVal data As List(Of CCommand)) As List(Of DataSet)

    'Remote Driver Access
    Function AllTableNames(withSchema As Boolean) As List(Of String)
    Property SchemaInfo() As CSchemaInfo

    'SqlServer only (or via webservice)
    Sub BulkInsert(ByVal dt As DataTable, ByVal tableName As String, ByVal mappings As Dictionary(Of Integer, Integer), useTx As Boolean)

End Interface

